#include<iostream>
#include<list>
#include<iterator>
using namespace std;
list<int> l;
int p=0;
void list_insert(int x)
{
    l.push_front(x);
    p = 0;
}
void list_move(int d)
{
    if (d > 0)
        p = d+1;
    else
        p = p - d;
    
}
void list_erase()
{
    l.remove(p);
}
int main()
{
    int n;
    cin >> n;
    while (n--)
    {
        int m;
        cin >> m;
        if (m == 0)
        {
            int x;
            cin >> x;
            list_insert(x);
        }
        else if (m == 1)
        {
            int d;
            cin >> d;
            list_move(d);
        }
        else
        {
            list_erase();
        }
    }
    for (std::list<int>::iterator it = l.begin(); it != l.end(); ++it) {
        std::cout << *it << '\n';
    }
    return 0;
}